!function(){
	if (sessionInfo) {
		$(".headerv1-user").addClass("headerv1-login-action");
		$(".signin-head-icon").css("display","block");
		if (sessionInfo["pic"]) {
			$(".signin-head-icon").attr("src",sessionInfo["pic"]);
		}else {
			$(".signin-head-icon").attr("src",staticRUL+"/img/Fsl8JQV5Y59_Cat6DgxgamCNEoO-.png");
		}


	}else {
		$(".headerv1-user").removeClass("headerv1-login-action");
	}

	$(".user-login").click(function() {
		if(!sessionInfo){
			$("#sign-modal").modal('show');
		}else {
			
		}
	}) 

	var signStyle = 0;
	$(".login-btn").click(function() {
		if(signStyle == 0)return;
		signStyle = 0;
		$(this).addClass("select-active");
		$("#signin-btn").text("登陆");
		$(".regist-btn").removeClass("select-active");
		resetSign();

	});
	$(".regist-btn").click(function() {
		if(signStyle == 1)return;
		signStyle = 1;
		$(this).addClass("select-active");
		$("#signin-btn").text("注册");
		$(".login-btn").removeClass("select-active");	
		resetSign();
	});

	function resetSign() {
		$(".sign input").each(function(i,el){
			$(this).val("");
		})
	} 

	$("#signin-btn").click(function() {
		if ($("#sign_count").val().length ==0) {
			remindSignText("用户名为空");
			return;
		}
		if ($("#sign_pwd").val().length ==0) {
			remindSignText("密码为空");
			return;
		}
		if ($("#VerifyText").val().length == 0) {
			remindSignText("验证码为空");
			return;
		}
		var param = {"usercount":$("#sign_count").val(),
					"password":$("#sign_pwd").val(),
					"verifycode":$("#VerifyText").val()}; 
		var url;
		if (signStyle == 0) {url=staticApi+"Api/loginAction";}
		if (signStyle == 1) {url=staticApi+"Api/registAction";}					
		$.post(url,param,function(respostObj) {
			if (respostObj["rt"] != 1) {
				remindSignText (respostObj["msg"]);
			}else {
				remindSignText (respostObj["msg"]);
				if (signStyle == 0) {
					window.location.reload();
				}else {
					$(".login-btn").trigger("click");
					
				}
			}
		});
	})

	function remindSignText(info) {
		$("#sign-remind").text(info);
		setTimeout("$('#sign-remind').text('');",2000);
	}

	$("#sign-user-logout").click(function(){
		$.post(staticApi+"Api/logoutAction",function(respostObj){
			if (respostObj["rt"] == 1) {
				window.location.reload();
			}
		});
	})



	$(".play-music-image").click(function() {
		if (vue.current_obj.id != undefined) {
			$("#lyrics-modal").modal("show");
			var lyr = vue.current_obj.lyrics;
			$(".lyrics p").text(lyr);



		}


		


	})




}();	